From: Corey Farwell Date: Tue, 3 May 2016 01:18:14 +0000 (-0400) Subject: Utilize `if let` construct over single branch `match`. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~14^2~28^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=d6126ba610f29aecee31eb1cf2310fb97076ee9e;p=cargo.git Utilize `if let` construct over single branch `match`. --- diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 288aa2be5..5e0d3868e 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -156,9 +156,8 @@ pub fn to_manifest(contents: &[u8], pub fn parse(toml: &str, file: &Path) -> CargoResult { let mut parser = toml::Parser::new(&toml); - match parser.parse() { - Some(toml) => return Ok(toml), - None => {} + if let Some(toml) = parser.parse() { + return Ok(toml); } let mut error_str = format!("could not parse input as TOML\n"); for error in parser.errors.iter() {